package com.example.wc.logindemolistview;

import android.support.v4.app.Fragment;

public class HomepageActivity extends SingleFragmentActivity {
    @Override
    protected Fragment createFragment() {
        return new HomepageFragment();
    }

/*通用代码，不通用的地方是HomepageActivity类在添加到FragmentManager之前的实例化部分：
 …… = new HomepageFragment(); 环境：…… extends AppCompatActivity*/
    /*@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment);

        FragmentManager fm = getSupportFragmentManager();
        Fragment fragment = fm.findFragmentById(R.id.fragment_container);

        if(fragment == null){
            fragment = new HomepageFragment();
            fm.beginTransaction()
                    .add(R.id.fragment_container, fragment)
                    .commit();
        }
    }*/

}
